package handler;

import builder.RequestBuilder;
import Interceptor.RequestInterceptor2;
import Interceptor.ResponseInterceptor2;
import SyncPools.URLConfig;

import connection.HttpRequest;

public final class RequestHandler {
	private HttpRequest httpRequest;

	private RequestBuilder requestBuilder;

	public RequestHandler(URLConfig config, HttpRequest httpRequest) {
		this.httpRequest = httpRequest;
		requestBuilder = new RequestBuilder().config(config);
	}

	public final void SendPost() {
		httpRequest.sendPost(requestBuilder);
	}

	public final void SendGet() {

		httpRequest.sendGet(requestBuilder);
	}

	public void stop() {
		httpRequest.stop();
	}

	public void cancle() {
		httpRequest.cancle();
	}

	public void addRequestInterceptor(RequestInterceptor2 requestInterceptor) {
		// TODO Auto-generated method stub
		httpRequest.addRequestInterceptor(requestInterceptor);
	}

	public void addResponseInterceptor(ResponseInterceptor2 responseInterceptor) {
		httpRequest.addResponseInterceptors(responseInterceptor);
	}

	public HttpRequest getHttpRequest() {
		return httpRequest;
	}

	public RequestBuilder getRequestBuilder() {
		return requestBuilder;
	}

}
